
<h1><?php echo $this->title?></h1>

<?php if(isset($_GET['sparql'])):?>
	<form action="/services/sparql" method="get" accept-charset="utf-8">
		<label>Sparql:
			<textarea name="query"><?php echo htmlentities($query)?></textarea>
		</label>
		<p><input type="submit" value="Query &rarr;"></p>
	</form>
<?php else:?>	
<form  method="get" accept-charset="utf-8" class="search">
	<input type="text" name="q" value="<?php if(isset($_GET['q'])) echo htmlentities($_GET['q'])?>" /><input value="Search" type="submit"/>
</form>
<?php endif;?>
<?php $count_results=0;?>
<?php if(!empty($resources)):?>

<ol>
<?php foreach($resources as $uri => $properties):?>
	<?php if(substr($uri,0,2)!='_:'):?>
		<?php $count_results++;?>
	<li>
		<?php
		
		if(isset($properties['dc:title'])) $prop = 'dc:title';
		else if(isset($properties['rdfs:label'])) $prop =  'rdfs:label';
		else $prop = false; 
		?>
		<h2 xml:lang="<?php if($prop) echo $properties[$prop][0]['lang']?>">
			<a href="/Res/?uri=<?php echo urlencode($uri)?>"><?php echo (isset($properties[$prop]))? $properties[$prop][0]['value'] : $uri?></a>
			<span class="uri">(<?php echo $uri?>)</span>
		</h2>
	
	</li>
	<?php endif?>
<?php endforeach?>
</ol>
<?php elseif(!$this->filter_required):?>

	<p>
		There were no matching results - sorry.
	</p>
<?php endif?>

<?php include 'elements/pager.html'; ?>	


</div>

